package com.gombe.credit.app.utils.helper

import android.Manifest
import com.gombe.credit.app.GombeCreditApp
import com.gombe.credit.app.R
import org.json.JSONArray
import org.json.JSONObject

object GombeCreditPermissionHelper {

    /**
     * sms
     */
    fun queryGombeCreditPermissionItem1(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",true)
        item.put("permission", Manifest.permission.READ_SMS)
        item.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_sms_title))
        item.put("icon",R.mipmap.gombe_credit_image_permission_sms_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_sms_why))
        obj1.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_sms_why_reason))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_sms_do))
        obj2.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_sms_do_reason))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_sms_data_safety))
        obj3.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_sms_data_safety_reason))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * phone state
     */
    fun queryGombeCreditPermissionItem2(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", GombeCreditApp.app.getString(R.string.gombe_credit_permission_phone_state_title))
        item.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_phone_state_title))
        item.put("icon",R.mipmap.gombe_credit_image_permission_device_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_phone_state_reason))
        msgArray.put(obj1)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * app list
     */
    fun queryGombeCreditPermissionItem3(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission",GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_title))
        item.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_title))
        item.put("icon",R.mipmap.gombe_credit_image_permission_app_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason1_title))
        obj1.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason2_title))
        obj2.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title",  GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason3_title))
        obj3.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason2))
        msgArray.put(obj3)

        val obj4 = JSONObject()
        obj4.put("title",  GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason4_title))
        obj4.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_app_list_reason4))
        msgArray.put(obj4)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * camera
     */
    fun queryGombeCreditPermissionItem4(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",true)
        item.put("permission", Manifest.permission.CAMERA)
        item.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_camera_title))
        item.put("icon",R.mipmap.gombe_credit_image_permission_camera_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_camera_reason1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_camera_reason2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", "")
        obj3.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_camera_reason3))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * album
     */
    fun queryGombeCreditPermissionItem5(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", GombeCreditApp.app.getString(R.string.gombe_credit_permission_album_title))
        item.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_album_title))
        item.put("icon",R.mipmap.gombe_credit_image_permission_album_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_album_reason1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_album_reason2))
        msgArray.put(obj2)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * address book
     */
    fun queryGombeCreditPermissionItem6(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", GombeCreditApp.app.getString(R.string.gombe_credit_permission_address_book_title))
        item.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_address_book_title))
        item.put("icon",R.mipmap.gombe_credit_image_permission_phone_book_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_address_book_reason1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_address_book_reason2))
        msgArray.put(obj2)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * storage
     */
    fun queryGombeCreditPermissionItem7(): JSONObject {
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("permission", GombeCreditApp.app.getString(R.string.gombe_credit_permission_storage_title))
        item.put("title", GombeCreditApp.app.getString(R.string.gombe_credit_permission_storage_title))
        item.put("icon",R.mipmap.gombe_credit_image_permission_storage_icon)
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_storage_reason1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_storage_reason2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", "")
        obj3.put("des", GombeCreditApp.app.getString(R.string.gombe_credit_permission_storage_reason3))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }
}